#include "capture.h"
#include "dial.h"
#include "onu_comm.h"

extern thread_pool_t *Tpool;

void* tcp_task(void* arg)
{

    dial_arg_t dial_arg = {0};
    dial_result_t* dial_result;

    dial_arg.bridge_mode = 0;
    dial_arg.in.tcp_arg.ip = inet_addr("182.140.167.44");
    // dial_arg.in.tcp_arg.ip = inet_addr("10.0.2.23");
    dial_arg.in.tcp_arg.port = htons(80);
    dial_arg.in.tcp_arg.timeout = 2;
    dial_result = (dial_result_t*)dial_tcp(&dial_arg);
    tcp_result_print(&dial_result->out.tcp_result);
    free(dial_result);

    return NULL;
}

int tcp_conn_task_init(int argc, char** argv)
{
    thread_pool_add_task(Tpool, tcp_task, NULL);
    return 0;
}
